package com.woniu.platform.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniu.platform.entity.PlatformLoan;
import com.woniu.platform.mapper.PlatformLoanMapper;
import com.woniu.platform.service.PlatformLoadService;
import com.woniu.util.utils.HttpResult;
import com.woniu.util.utils.RequestParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PlatfromLoadServiceImpl implements PlatformLoadService {
    @Autowired
    private PlatformLoanMapper platformLoanMapper;

    /**
     * 分页查询放款记录
     * @param request
     * @return
     */
    @Override
    public HttpResult queryLoanList(RequestParam<PlatformLoan> request) {
        PageHelper.startPage(request.getPageNum(), request.getPageSize());
        List<PlatformLoan> loanList =platformLoanMapper.queryLoanList(request.getData().getFinaceName(),request.getData().getCoreName());
        PageInfo pageInfo = new PageInfo(loanList);
        return new HttpResult().ok(pageInfo);
    }
}
